import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 业务-运营-补单-账号充值信息 */
export interface BusinessPay {
  id: number; // 编号
  shopId?: number; // 店铺
  wechat: string; // 微信号
  thisMonthAppliedAmount: number; // 本月已申请金额
  lastMonthBalance: number; // 上月账户余额
  theAppliedAmount: number; // 本次申请账户余额
  thisMonthBusinessMoney: number; // 本月补单金额合计
  remainingBalance: number; // 应余余额
  difference: number; // 差额
  wechatBalanceImg: string; // 微信余额截图
  payMoney: number; // 充值金额
  payTime: string | Dayjs; // 充值时间
  status: string; // 状态
  remark: string; // 备注
  processInstanceId: string; // 流程实例id
}

// 业务-运营-补单-账号充值 API
export const BusinessPayApi = {
  // 查询业务-运营-补单-账号充值分页
  getBusinessPayPage: async (params: any) => {
    return await request.get({ url: `/operation/business-pay/page`, params })
  },

  // 查询业务-运营-补单-账号充值详情
  getBusinessPay: async (id: number) => {
    return await request.get({ url: `/operation/business-pay/get?id=` + id })
  },

  // 新增业务-运营-补单-账号充值

  createBusinessPay: async (data: BusinessPay) => {
    return await request.post({ url: `/operation/business-pay/create`, data })
  },

  // 修改业务-运营-补单-账号充值
  updateBusinessPay: async (data: BusinessPay) => {
    return await request.put({ url: `/operation/business-pay/update`, data })
  },

  // 删除业务-运营-补单-账号充值
  deleteBusinessPay: async (id: number) => {
    return await request.delete({ url: `/operation/business-pay/delete?id=` + id })
  },

  /** 批量删除业务-运营-补单-账号充值 */
  deleteBusinessPayList: async (ids: number[]) => {
    return await request.delete({ url: `/operation/business-pay/delete-list?ids=${ids.join(',')}` })
  },

  // 导出业务-运营-补单-账号充值 Excel
  exportBusinessPay: async (params) => {
    return await request.download({ url: `/operation/business-pay/export-excel`, params })
  }
}
